package org.moonlight.jvm.instructions.loads.lload;

import org.moonlight.jvm.instructions.base.Index8Instruction;
import org.moonlight.jvm.rtda.exclusive.Frame;

/**
 * LLOAD: 根据索引下标 {@link LLoad#idx}, 从 局部变量表 获取 long型变量, 然后推入操作数栈顶
 *        其索引来自操作数
 *
 * @author Moonlight
 * @createTime 2023/8/16 15:04
 **/
public class LLoad extends Index8Instruction {

    @Override
    public void execute(Frame frame) {
        lLoadN(frame, this.idx);
    }

    static void lLoadN(Frame frame, int n) {
        long val = frame.getLocalVars().getLong(n);
        frame.getOperandStack().pushLong(val);
    }
}
